﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TerhelesEloszto.Common;

namespace TerhelesEloszto.Engine
{
	/// <summary>
	/// Tantárgyat reprezentáló osztály.
	/// </summary>
	class Fact : IFact
	{
		#region IFact Members

		/// <summary>
		/// A tantárgy neve.
		/// </summary>
		public string Name
		{
			get { return name; }
			set { name = value; }
		}

		/// <summary>
		/// A tantárgy neptun kódja. (Egyedi azonosító.)
		/// </summary>
		public string Neptun
		{
			get { return neptun; }
			set { neptun = value; }
		}

		/// <summary>
		/// A tantárgy leírása.
		/// </summary>
		public string Description
		{
			get { return description; }
			set { description = value; }
		}

		#endregion

		/// <summary>
		/// Konstruktor linq entitázsból.
		/// </summary>
		/// <param name="fact">A linq entitázs.</param>
		internal Fact( FACT fact )
		{
			neptun = fact.NEPTUN;
			name = fact.NAME;
			description = fact.DESCRIPTION;
		}

		private string name;
		private string neptun;
		private string description;

		public override bool Equals( object obj )
		{
			if( obj is IFact )
			{
				IFact o = (IFact)( obj );
				return o.Neptun.Trim() == neptun.Trim();

			}
			else
			{
				return base.Equals( obj );
			}
		}
	}
}
